﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Collections.Generic;
using Kaesoft.Hospedaje.Entities;

namespace Kaesoft.Hospedaje.Proxy.ParametrizacionReference
{
    public partial class ServicioParametrizacionClient
    {
        public void ObtenerCatalogosAsync(int tipoCatalogo, Action<ObtenerCatalogosCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerCatalogosDelegate == null))
            {
                this.onBeginObtenerCatalogosDelegate = new BeginOperationDelegate(this.OnBeginObtenerCatalogos);
            }
            if ((this.onEndObtenerCatalogosDelegate == null))
            {
                this.onEndObtenerCatalogosDelegate = new EndOperationDelegate(this.OnEndObtenerCatalogos);
            }

            System.Threading.SendOrPostCallback customObtenerCatalogosDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerCatalogosCompletedEventArgs eventArg = new ObtenerCatalogosCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerCatalogosDelegate, new object[] { 
            tipoCatalogo }, this.onEndObtenerCatalogosDelegate, customObtenerCatalogosDelegate, null);
        }

        public void ObtenerCatalogoSummaryAsync(int tipoCatalogo, Action<ObtenerCatalogoSummaryCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerCatalogoSummaryDelegate == null))
            {
                this.onBeginObtenerCatalogoSummaryDelegate = new BeginOperationDelegate(this.OnBeginObtenerCatalogoSummary);
            }
            if ((this.onEndObtenerCatalogoSummaryDelegate == null))
            {
                this.onEndObtenerCatalogoSummaryDelegate = new EndOperationDelegate(this.OnEndObtenerCatalogoSummary);
            }

            System.Threading.SendOrPostCallback customObtenerCatalogoSummaryDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerCatalogoSummaryCompletedEventArgs eventArg = new ObtenerCatalogoSummaryCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerCatalogoSummaryDelegate, new object[] {
                        tipoCatalogo}, this.onEndObtenerCatalogoSummaryDelegate, customObtenerCatalogoSummaryDelegate, null);
        }

        public void ObtenerCatalogoSummaryPorCriterioAsync(int tipoCatalogo, int tipoConsulta, string criterio, int indice, Action<ObtenerCatalogoSummaryPorCriterioCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerCatalogoSummaryPorCriterioDelegate == null))
            {
                this.onBeginObtenerCatalogoSummaryPorCriterioDelegate = new BeginOperationDelegate(this.OnBeginObtenerCatalogoSummaryPorCriterio);
            }
            if ((this.onEndObtenerCatalogoSummaryPorCriterioDelegate == null))
            {
                this.onEndObtenerCatalogoSummaryPorCriterioDelegate = new EndOperationDelegate(this.OnEndObtenerCatalogoSummaryPorCriterio);
            }

            System.Threading.SendOrPostCallback customObtenerCatalogoSummaryPorCriterioDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerCatalogoSummaryPorCriterioCompletedEventArgs eventArg = new ObtenerCatalogoSummaryPorCriterioCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerCatalogoSummaryPorCriterioDelegate, new object[] {
                        tipoCatalogo,
                        tipoConsulta,
                        criterio,
                        indice}, this.onEndObtenerCatalogoSummaryPorCriterioDelegate, customObtenerCatalogoSummaryPorCriterioDelegate, null);
        }

        public void ObtenerParametrosSistemaAsync(Action<ObtenerParametrosSistemaCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerParametrosSistemaDelegate == null))
            {
                this.onBeginObtenerParametrosSistemaDelegate = new BeginOperationDelegate(this.OnBeginObtenerParametrosSistema);
            }
            if ((this.onEndObtenerParametrosSistemaDelegate == null))
            {
                this.onEndObtenerParametrosSistemaDelegate = new EndOperationDelegate(this.OnEndObtenerParametrosSistema);
            }

            System.Threading.SendOrPostCallback customObtenerParametrosSistemaDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerParametrosSistemaCompletedEventArgs eventArg = new ObtenerParametrosSistemaCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerParametrosSistemaDelegate, null, this.onEndObtenerParametrosSistemaDelegate, customObtenerParametrosSistemaDelegate, null);
        }

        public void GrabarParametroSistemaAsync(List<Parametro> parametros, Action<AsyncCompletedEventArgs> method)
        {
            if ((this.onBeginGrabarParametroSistemaDelegate == null))
            {
                this.onBeginGrabarParametroSistemaDelegate = new BeginOperationDelegate(this.OnBeginGrabarParametroSistema);
            }
            if ((this.onEndGrabarParametroSistemaDelegate == null))
            {
                this.onEndGrabarParametroSistemaDelegate = new EndOperationDelegate(this.OnEndGrabarParametroSistema);
            }

            System.Threading.SendOrPostCallback customGrabarParametroSistemaDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    AsyncCompletedEventArgs eventArg = new AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginGrabarParametroSistemaDelegate, new object[] {
                        parametros}, this.onEndGrabarParametroSistemaDelegate, customGrabarParametroSistemaDelegate, null);
        }

        public void ObtenerTipoCatalogosAsync(Action<ObtenerTipoCatalogosCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerTipoCatalogosDelegate == null))
            {
                this.onBeginObtenerTipoCatalogosDelegate = new BeginOperationDelegate(this.OnBeginObtenerTipoCatalogos);
            }
            if ((this.onEndObtenerTipoCatalogosDelegate == null))
            {
                this.onEndObtenerTipoCatalogosDelegate = new EndOperationDelegate(this.OnEndObtenerTipoCatalogos);
            }

            System.Threading.SendOrPostCallback customObtenerTipoCatalogosDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerTipoCatalogosCompletedEventArgs eventArg = new ObtenerTipoCatalogosCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerTipoCatalogosDelegate, null, this.onEndObtenerTipoCatalogosDelegate, customObtenerTipoCatalogosDelegate, null);
        }

        public void GrabarCatalogoAsync(List<Catalogo> catalogos, Action<AsyncCompletedEventArgs> method)
        {
            if ((this.onBeginGrabarCatalogoDelegate == null))
            {
                this.onBeginGrabarCatalogoDelegate = new BeginOperationDelegate(this.OnBeginGrabarCatalogo);
            }
            if ((this.onEndGrabarCatalogoDelegate == null))
            {
                this.onEndGrabarCatalogoDelegate = new EndOperationDelegate(this.OnEndGrabarCatalogo);
            }

            System.Threading.SendOrPostCallback customGrabarCatalogoDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    AsyncCompletedEventArgs eventArg = new AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginGrabarCatalogoDelegate, new object[] {
                        catalogos}, this.onEndGrabarCatalogoDelegate, customGrabarCatalogoDelegate, null);
        }

        public void GrabarTipoCatalogoAsync(List<EstructuraCatalogo> tipos, Action<AsyncCompletedEventArgs> method)
        {
            if ((this.onBeginGrabarTipoCatalogoDelegate == null))
            {
                this.onBeginGrabarTipoCatalogoDelegate = new BeginOperationDelegate(this.OnBeginGrabarTipoCatalogo);
            }
            if ((this.onEndGrabarTipoCatalogoDelegate == null))
            {
                this.onEndGrabarTipoCatalogoDelegate = new EndOperationDelegate(this.OnEndGrabarTipoCatalogo);
            }

            System.Threading.SendOrPostCallback customGrabarTipoCatalogoDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    AsyncCompletedEventArgs eventArg = new AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginGrabarTipoCatalogoDelegate, new object[] {
                        tipos}, this.onEndGrabarTipoCatalogoDelegate, customGrabarTipoCatalogoDelegate, null);
        }

        public void ObtenerUsuariosAsync(Action<ObtenerUsuariosCompletedEventArgs> method)
        {
            if ((this.onBeginObtenerUsuariosDelegate == null))
            {
                this.onBeginObtenerUsuariosDelegate = new BeginOperationDelegate(this.OnBeginObtenerUsuarios);
            }
            if ((this.onEndObtenerUsuariosDelegate == null))
            {
                this.onEndObtenerUsuariosDelegate = new EndOperationDelegate(this.OnEndObtenerUsuarios);
            }

            System.Threading.SendOrPostCallback customObtenerUsuariosDelegate = new System.Threading.SendOrPostCallback(
            state =>
            {
                if (method != null)
                {
                    InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                    ObtenerUsuariosCompletedEventArgs eventArg = new ObtenerUsuariosCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState);
                    if (!WcfProxyInvoker.ExistenErroresAsync(eventArg.Error))
                        Deployment.Current.Dispatcher.BeginInvoke(method, eventArg);
                }
            }
            );

            base.InvokeAsync(this.onBeginObtenerUsuariosDelegate, null, this.onEndObtenerUsuariosDelegate, customObtenerUsuariosDelegate, null);
        }
    }
}